home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / addres / dial.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  2.9 KB  |  99 lines

  1. VERSION 2.00
  2. Begin Form Dial 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Phone Dialer"
  5.    ClientHeight    =   945
  6.    ClientLeft      =   2745
  7.    ClientTop       =   3210
  8.    ClientWidth     =   2805
  9.    Height          =   1350
  10.    Left            =   2685
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   945
  15.    ScaleWidth      =   2805
  16.    Top             =   2865
  17.    Width           =   2925
  18.    Begin MSComm Comm1 
  19.       Interval        =   1000
  20.       Left            =   120
  21.       Top             =   480
  22.    End
  23.    Begin CommandButton Command2 
  24.       Caption         =   "&Hang-Up"
  25.       FontBold        =   -1  'True
  26.       FontItalic      =   0   'False
  27.       FontName        =   "Arial"
  28.       FontSize        =   9.75
  29.       FontStrikethru  =   0   'False
  30.       FontUnderline   =   0   'False
  31.       Height          =   375
  32.       Left            =   840
  33.       TabIndex        =   2
  34.       Top             =   480
  35.       Visible         =   0   'False
  36.       Width           =   1095
  37.    End
  38.    Begin CommandButton Command1 
  39.       Caption         =   "&Dial"
  40.       FontBold        =   -1  'True
  41.       FontItalic      =   0   'False
  42.       FontName        =   "Arial"
  43.       FontSize        =   9.75
  44.       FontStrikethru  =   0   'False
  45.       FontUnderline   =   0   'False
  46.       Height          =   375
  47.       Left            =   840
  48.       TabIndex        =   1
  49.       Top             =   480
  50.       Width           =   1095
  51.    End
  52.    Begin TextBox Text1 
  53.       FontBold        =   -1  'True
  54.       FontItalic      =   0   'False
  55.       FontName        =   "Courier"
  56.       FontSize        =   9.75
  57.       FontStrikethru  =   0   'False
  58.       FontUnderline   =   0   'False
  59.       Height          =   285
  60.       Left            =   120
  61.       TabIndex        =   0
  62.       Top             =   120
  63.       Width           =   2535
  64.    End
  65. Sub Command1_Click ()
  66. 'dial the number mscomm makes it easy
  67. On Error Resume Next
  68. Comm1.CommPort = TheComm
  69. If Err Then
  70.     Beep
  71.     Msg$ = "Comm Port " & CStr(TheComm) & " Not Available."
  72.     MsgBox Msg$, 16, ErrorMsg
  73.     On Error GoTo 0
  74.     Unload Dial
  75. End If
  76. Comm1.Settings = "300,N,8,1"
  77. Comm1.InputLen = 0
  78. Comm1.PortOpen = True
  79. Comm1.Output = "ATDT" & Trim$(Text1.Text) & ";" & Chr$(13)
  80. Command1.Visible = False
  81. Command2.Visible = True
  82. End Sub
  83. Sub Command2_Click ()
  84. 'hang up when user ready and unload
  85. Comm1.Output = "ATH" & Chr$(13)
  86. Unload Dial
  87. End Sub
  88. Sub Form_Load ()
  89. Dial.Top = Address.Top + (Address.Height - Dial.Height) \ 3
  90. Dial.Left = Address.Left + (Address.Width - Dial.Width) \ 2
  91. End Sub
  92. Sub Form_Unload (Cancel As Integer)
  93. 'need to make sure port is closed. error checking needed
  94. 'because we may have not opened the device before we unload
  95. On Error Resume Next
  96. Comm1.PortOpen = False
  97. On Error GoTo 0
  98. End Sub
  99.